********************************************************************************
*																			   *
*						Sir! I'd Rather Go to School Sir!					   *
*																			   *
*								 Mahdi Majbouri								   *
*																			   *
*									 Table 4								   *
*																			   *
*									6-6-2023								   *
*																			   *
********************************************************************************

// NOTE THAT THIS IS BASED ON OLD VERSION OF rd COMMAND.


use "census11-all.dta", clear

keep if fage>=fage18 & fage18>=threshold - 14 & fage18<=threshold + 15

ssc install rd

*** Regressions for sole sons
*rdbwselect college_plus fa if relate==3 & son==1 & sons == 1 & fage>=fage18 & urban == 2, c(1)
rd college_plus fa if relate==3 & son==1 & sons == 1 & fage>=fage18 & urban == 2, strineq covar(father_ed mom_ed fage mage) cluster(fa) 


display e(N)


*** Regressions for sole sons's sisters
rd college_plus fa if relate==3 & son==0 & sons == 1 & fage>=fage18 & urban == 2, strineq covar(father_ed mom_ed fage mage) cluster(fa)

display e(N)



********************************************************************************
**  Robustness check - Regressions for boys in multiple son families
********************************************************************************

use "census11-all.dta", clear

keep if fage>=fage18 & fage18>=threshold - 14 & fage18<=threshold + 15

** Regressions for sons in multiple-son households
rd college_plus fa if relate==3 & son==1 & sons > 1 & fage>=fage18 & urban == 2, strineq covar(father_ed mom_ed fage mage) cluster(fa)

display e(N)	
	
********************************************************************************
*********************************  THE END *************************************
********************************************************************************
